/**
 * 用户订阅相关接口
 */
import request from '@/config/request'
import type { CvSubscribePageReqVO, CvSubscribeSaveReqVO } from '@/types/subscribe'
import type { CvSubscribeSearchReqVO } from '@/types/subscribe'

/**
 * 保存订阅
 */
export const saveSubscribe = (data: CvSubscribeSaveReqVO) => {
  return request.post({ url: '/platform/subscribe/save', data })
}

/**
 * 取消订阅
 */
export const cancelSubscribe = (id: number) => {
  return request.delete({ url: '/platform/subscribe/delete', params: { id } })
}

/**
 * 通过用户编号取消关注
 */
export const cancelSubscribeByUserId = (targetId: number) => {
  return request.delete({ url: '/platform/subscribe/deleteByUserId', params: { targetId } })
}

/**
 * 获取订阅信息
 */
export const getSubscribe = (targetId: number) => {
  return request.get({ url: '/platform/subscribe/get', params: { targetId } })
}

/**
 * 用户订阅分页数据
 */
export const getSubscribePage = (reqVO: CvSubscribeSearchReqVO) => {
  return request.get({ url: '/platform/subscribe/page', params: reqVO })
}

/**
 * 用户粉丝分页数据
 */
export const getFansPage = (reqVO: CvSubscribePageReqVO) => {
  return request.get({ url: '/platform/subscribe/fansPage', params: reqVO })
}

/**
 * 用户关注分页数据
 */
export const getFollowPage = (reqVO: CvSubscribePageReqVO) => {
  return request.get({ url: '/platform/subscribe/followPage', params: reqVO })
}
